package cn.cxq.learning.search;

/**
 * 线性查找
 */
public class LinearSearch {

    public static int search(int[] arr, int value) {
        int index;
        for (index = 0; index < arr.length; index++) {
            if (arr[index] == value) break;
        }
        if (index == arr.length) return -1;
        else return index;
    }
}
